/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.orderlang.productDetail.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.bussiness.orderlang.productDetail.domain.ProductDetail;
import com.seeyoui.kensite.bussiness.orderlang.productDetail.persistence.ProductDetailMapper;

/**
 * ProductDetail
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-02-07
 */

@Service
public class ProductDetailService extends BaseService {
	
	@Autowired
	private ProductDetailMapper productDetailMapper;

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public ProductDetail findOne(String id) throws CRUDException{
		return productDetailMapper.findOne(id);
	}
	
	public void deleteByProductId(String productId){
		productDetailMapper.deleteByProductId(productId);
	}
	
	/**
	 * 查询数据集合
	 * @param productDetail
	 * @return
	 * @throws CRUDException
	 */
	public List<ProductDetail> findList(ProductDetail productDetail) throws CRUDException {
		return productDetailMapper.findList(productDetail);
	}
	
	/**
	 * 查询所有数据集合
	 * @param productDetail
	 * @return
	 * @throws CRUDException
	 */
	public List<ProductDetail> findAll(ProductDetail productDetail) throws CRUDException {
		return productDetailMapper.findAll(productDetail);
	}
	
	/**
	 * 查询数据总数
	 * @param productDetail
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(ProductDetail productDetail) throws CRUDException {
		return productDetailMapper.findTotal(productDetail);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param productDetail
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(ProductDetail productDetail) throws CRUDException {
		return productDetailMapper.findExTotal(productDetail);
	}
	
	/**
	 * 数据新增
	 * @param productDetail
	 * @throws CRUDException
	 */
	public void save(ProductDetail productDetail) throws CRUDException{
		productDetail.preInsert();
		productDetailMapper.save(productDetail);
	}
	
	/**
	 * 数据修改
	 * @param productDetail
	 * @throws CRUDException
	 */
	public void update(ProductDetail productDetail) throws CRUDException{
		productDetail.preUpdate();
		productDetailMapper.update(productDetail);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		productDetailMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param productDetail
	 * @throws CRUDException
	 */
	public void remove(ProductDetail productDetail) throws CRUDException{
		productDetail.preUpdate();
		productDetailMapper.remove(productDetail);			
	}
	
}